package com.emergency.embackend.utils;

import cn.hutool.core.util.RandomUtil;
import java.util.ArrayList;
import java.util.List;

/**
 * @author chddd
 * @description
 * @create 2024/4/3 22:09:15
 */
public class RandomIdUtils {
    public static List<Long> getRandomNum(List<Long> ids){
        List<Long> resRandomIds = new ArrayList<>();
        while(ids!=null && ids.size()!=0) {
            int index = RandomUtil.randomInt(0, ids.size() - 1);
            resRandomIds.add(ids.get(index));
            ids.remove(index);
            //删除当前的元素
        }
        return resRandomIds;
    }
}
